/*
 * Copyright (c) 2024 iSOFT INFRASTRUCTURE SOFTWARE CO., LTD.
 * easyAda is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */

#include <plat/device.h>
#include <tools/macros.h>
#include <uapi/bootinfo.h>

#define KB *(1024)
#define MB *(1024 KB)

extern unsigned long k_ro_start, k_ro_end;
extern unsigned long boot_physic_start, boot_physic_end;
extern unsigned long boot_end;
extern unsigned long k_text_start, k_text_end;
extern unsigned long k_rodata_start, k_rodata_end;
extern unsigned long rs_ro_start, rs_ro_end;
extern unsigned long k_ro_shared_start, k_ro_shared_end;
extern unsigned long k_rw_start, k_rw_end;
extern unsigned long k_stack_start, k_stack_end;
extern unsigned long bss_start, bss_end;
extern unsigned long k_shared_start, k_shared_end;
extern unsigned long k_ro_shared_end;
extern unsigned long k_rw_start;
extern unsigned long k_shared_end;
extern unsigned long rs_ro_size;

const region_t SHARED_RO ksram[] = {
    { .pbase = CONFIG_LOAD_ADDR, .vbase = CONFIG_EXEC_ADDR, .size = 128 MB },
    { .size = 0 },
};

const region_t SHARED_RO paksram[] = {
    { .pbase = CONFIG_LOAD_ADDR + 128 MB, .vbase = CONFIG_EXEC_ADDR + 128 MB, .size = 128 MB },
    { .size = 0 },
};

const region_t SHARED_RO ksdev[] = {
    { .pbase = DEVICE_PBASE_UART, .vbase = DEVICE_VBASE_UART, .size = DEVICE_SIZE_UART1 },
    { .pbase = DEVICE_PBASE_GIC, .vbase = DEVICE_VBASE_GIC, .size = DEVICE_SIZE_GIC },
    { .size = 0 }
};

const region_t SHARED_RO
    usram[] = { { .pbase = 0x50000000, .vbase = CONFIG_ROOTSERVER_EXEC_ADDR + 128 MB, .size = 8 MB }, { .size = 0 } };

const region_t SHARED_RO usdev[] = {
    { .pbase = DEVICE_PBASE_UART, .vbase = CONFIG_ROOTSERVER_RDEV_ADDR, .size = DEVICE_SIZE_UART1 },
    { .size = 0 },
};
